package com.example.administrator.printer.module;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.example.administrator.printer.R;
import com.example.administrator.printer.base.BaseActivity;
import com.example.administrator.printer.module.feie.FeieActivity;
import com.example.administrator.printer.module.takeout.TakeoutManagerActivity;
import com.example.administrator.printer.module.yilianyun.YilianYunActivity;

public class MainActivity extends BaseActivity implements PrinterAdapter.OnItemClickListener {
    RecyclerView rv;

    PrinterAdapter adapter;

    String[] printers = new String[]{"外卖管家云打印机", "飞鹅云打印机", "易联云打印机"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        adapter = new PrinterAdapter(this, printers);
        adapter.setOnItemClickListener(this);
        rv = (RecyclerView) findViewById(R.id.rv);
        rv.setLayoutManager(new LinearLayoutManager(this));
        rv.setAdapter(adapter);
    }

    @Override
    public void onItemClick(int position) {
        Intent intent = null;
        switch (position) {
            case 0://外卖管家云打印机
                intent = new Intent(this, TakeoutManagerActivity.class);
                break;
            case 1://飞鹅云打印机
                intent = new Intent(this, FeieActivity.class);
                break;
            case 2://易联云打印机
                intent = new Intent(this, YilianYunActivity.class);
                break;
        }
        startActivity(intent);
    }
}
